/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once

#include "../../../S_Physics.h"

#include "../A_核心/FLIP核心.h"
#include "../B_物理体/FLIP流体.h"


struct S_PhysicsFLIP : public S_Physics {
	
	S_FluidCube*	m_Core;

	uint8			m_迭代次数;


	S_PhysicsFLIP();
	~S_PhysicsFLIP();



	void	f_Update();
	//void	f_Update车辆(S_Px车* 车);
	void	f_应用物理变换();

	void	f_取更新物体(std::vector<std::vector<Mat44f>>& mat, std::vector<std::vector<void*>>& userData);
	void	f_取更新物体(std::vector<Mat44f>& mat, std::vector<void*>& userData);
	void	f_取碰撞物体(std::vector<S_碰撞信息>& objs, uint32 scenekey);
	//void	f_等待更新结束();
	void	f_添加物理体(S_物理体* body, uint32 scenekey);
	void	f_移除物理体(S_物理体* body, uint32 scenekey);

	void	f_添加物理体碰撞回调(S_物理体* body, uint32 scenekey);


	void	f_计算散度(uint8 方向, float32* v, float32* v0, float32 散度);
	void	f_设置边界(uint8 方向, float32* v);
	void	f_计算边界(uint8 方向, float32* v, float32* v0, float32 预计算散度, float32 边界散度);
	void	f_线性方程求解(uint8 方向, float32* v, float32* v0, float32 a, float32 c);
	void	f_投影(float32* vx, float32* vy, float32* vz, float32* p, float32* div);
	void	f_流动(uint8 方向, float32* 密度, float32* 速度, float32* vx, float32* vy, float32* vz);


};









